package com.zjitc;

/**
 * Create by IntelliJ IDEA
 *
 * @author: jsonor
 * @date-Time: 2018/3/5 14:43
 * @description:
 */
public class User {
    private String username;
    private Integer age;
    private Home home;

    public User(){
      this("body",10);
    }

  public User(String username, Integer age) {
    this.username = username;
    this.age = age;
  }

  public User(String username, Integer age, Home home) {
    this.username = username;
    this.age = age;
    this.home = home;
  }

  public String getUsername() {
    return username;
  }

  public void setUsername(String username) {
    this.username = username;
  }

  public Integer getAge() {
    return age;
  }

  public void setAge(int age) {
    this.age = age;
  }

  public Home getHome() {
    return home;
  }

  public void setHome(Home home) {
    this.home = home;
  }

  @Override
  public String toString() {
    return "User{" +
        "username='" + username + '\'' +
        ", age=" + age +
        ", home=" + home +
        '}';
  }

  public void init() {
    System.out.println("init");
  }

  public void close() {
    System.out.println("close");
  }
  public static User createInstance(Integer age){
      if (age>100){
        return new User("bigger than 100",age);
      }else {
        return new User("smaller than 100",age);
      }
  }
}
